<template>
	<view>
		<page-meta>
			<navigation-bar :title="title"></navigation-bar>
		</page-meta>
		<view v-for="(list, key) in get.fields" :key="$index">
			<checkbox-group v-if="list && list.length>0">
				<view>{{types[key]}}</view>
				<view class="cell horizontal" v-for="(field, idx2) in list" :key="idx2">
					<view>{{field.name}}</view>
					<label v-if="field.chooseType==1">
						<checkbox :checked="field.value==1" disabled/><text>{{field.chooseVal}}</text>
					</label>
					<view v-else-if="field.chooseType==2">{{field.value || ''}}</view>
				</view>
			</checkbox-group>
		</view>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		onLoad(opts) {
			this.form = opts.form
			this.id=opts.id
			this.title=opts.title
			const url = opts.form==1?'workOrder/getCleanAndEquipmentRecord/':'workOrder/getDailyCheck/'
			
			uni.request({
				header:{
					Authorization: 'Bearer ' + app.globalData.token,
				},
				url: app.globalData.domain + url + opts.id,
				method: 'GET',
				data: {

				},
				success: res => {
					const {data} = res
					console.log(data)
					if(data.code==200){
						this.get.fields=data.data
					}else if(data.code==500){
						uni.showToast({
							icon:'none',
							title: data.message,
						});
					}
				},
				fail: (err) => {console.error(err)},
				complete: () => {}
			});
		},
		data() {
			return {
				types:{
					cleanList: '卫生清洁', equipmentList: '设备运行', dailyCheckList: '日常巡检',
				},
				id:'',
				title:'',
				get:{
					fields:{
						equipmentList:[
							
						],
						cleanList:[
							
						],
						dailyCheckList:[
							
						]
					}
				},
			}
		},
		methods: {

		}
	}
</script>

<style>

</style>
